home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
nwam9306.zip
/
MAXEY-06.ART
< prev
next >
Wrap
Text File
|
1993-06-07
|
5KB
|
135 lines
NWA-MCUG 6/93 NewsLetter Article
Rt 4 Box 376 Springdale, AR 72762-9307
SAMENAME
by
E. Stanton Maxey
Do you have multiple hard disks? Have you partitioned your big hard disk into
several drives? Do you sometimes find that you have saved the same program
in several different places? If your response to any of these questions is
"yes", SAMENAME may interest you.
SAMENAME consists of SAMENAME.BAT and SAMENAME.BAS. It requires that
ATTRIB.EXE and LIST.EXE be available in the same directory or somewhere on
your PATH. LIST.EXE is an external command program available on many BBSs.
CD1 must also be created and reside in the directory from which you intend to
implement SAMENAME.
CD1 is a text file used by SAMENAME.BAT in writing RETRN.BAT, a file which is
called to return you to the implementing directory. Create CD1 from the
keyboard by the following keystrokes:
Copy con CD1 [enter]
CD1 ^Z [enter] (That's a Ctrl+Z and then the enter key)
The space before the ^Z is necessary.
Here's the SAMENAME.BAT listing:
@echo off
copy cd1 c:\retrn.bat
cd >> c:\retrn.bat
cd\
cd >> c:\retrn.bat
if %1!==! goto MSG
REM set used to convert to Upper case
set %1=xxx
for %%a in(%BAT%, %COM%, %EXE%) do if %%a==xxx goto START
goto MSG
:START
set %1=
c:
cd\
attrib *.%1 /s > c:\txt
d:
cd\
attrib *.%1 /s >> c:\txt
g:
cd\
attrib *.%1 /s >> c:\txt
d:
cd\dos
gwbasic samename
c:
del txt
list samename.txt
del samename.txt
cls
goto END
:MSG
set %1=
echo SAMENAME requires one of the following parameters,
echo BAT or bat
echo COM or com
echo EXE or exe
:END
retrn
SAMENAME.BAT checks the C, D & G drives; you can edit this to include the
drives on your system. You must also edit the d: & cd\ lines preceding GWBASIC
SAMENAME if your GWBASIC is in some other drive or directory than those given.
Here's the SAMENAME.BAS listing.
10 DIM A$(1000)
20 OPEN "I", #1, "C:\TXT"
30 OPEN "O", #2, "C:\SAMENAME.TXT"
40 IF EOF (1) THEN GOTO 320
50 INPUT #1, A$
60 N=N+1' log number of entries
70 ' next line removes "A" attribute
80 IF LEFT$(A$,1)="A" THEN A$=RIGHT$(A$, LEN(A$)-11)
90 FOR V=1 TO LEN(A$)' get last "\" position
100 IF MID$(A$,V,1)="\" THEN B=V
110 NEXT V
120 C$=LEFT$(A$,B)' C$ is name of path
130 D$=RIGHT$(A$, LEN(A$)-(B))' D$ is path name of file
140 IF LEN (D$)<13 THEN D$=D$+" ":GOTO 140' D$ padded to 13
150 D$=D$+C$' D$ is now file name plus path
160 GOSUB 180
170 GOTO 40
180 FOR V1=1 TO N' Move strings to make space
190 IF A$(V1)="" THEN A$(V1)=D$:GOTO 280' Load D$ into A$(v1)
200 IF LEFT$(A$(V1),12)=LEFT$(D$,12) THEN GOSUB 290:GOTO 220
210 IF D$> A$(V1) GOTO 270' No change needed
220 FOR V2=N TO V1 STEP -1' Move strings down to make room
230 A$(V2)=A$(V2-1)
240 NEXT V2
250 A$(V1)=D$' Insert next D$ into A$(V1)
260 GOTO 280
270 NEXT V1
280 RETURN
290 IF LEN(D$)<40 THEN D$=D$+"-":GOTO 290' expand D$ with "-"
300 D$=D$+"-Duplicate file names" ' add duplicate tag
310 RETURN
320 FOR X=1 TO N' Create sorted file
330 PRINT #2,A$(X)
340 NEXT X
350 PRINT #2,N " files sorted."
360 SYSTEM
Upon entering SAMENAME from the keyboard you'll get an error message
requiring that the file extension you desire be included on the command line.
Upon proper entry SAMENAME
1) creates RETRN.BAT which it will call in order to return
you to the initiating directory,
2) uses ATTRIB with the "*" wildcard, the extension from the
command line and the "/s" switch to create a TXT file,
3) calls GWbasic SAMENAME to sort the TXT file, note
duplicates and create the SAMENAME.TXT file,
4) calls LIST to display the SAMENAME.TXT file,
5) deletes both the TXT and the SAMENAME.TXT files and
6) calls RETRN.BAT to get back to the originating directory.
Here's a sample of what LIST's output.
PCPLUS.EXE D:\PCPLUS\
PCSECURE.EXE D:\PCTOOLS\
PCSETUP.EXE D:\PCTOOLS\------------Duplicate file names
PCSETUP.EXE D:\PCPLUS\
PCSHELL.EXE D:\PCTOOLS\
PI.EXE C:\TP\EXEC\------------Duplicate file names
PI.EXE C:\TC\-----------------Duplicate file names
PI.EXE C:\TC\EXAMPLES\
PIANO.EXE D:\GAMES\
PKARC.EXE D:\SHEZ\PKARC\
Call Bill Shook and download this article if you'd like to try the programs
without having to enter them by hand. Have fun!